package com.ruoyi.system.service.impl;

import java.util.Date;
import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.VoucherOperationLogMapper;
import com.ruoyi.system.domain.VoucherOperationLog;
import com.ruoyi.system.service.IVoucherOperationLogService;

/**
 * 代金券操作记录，记录代金券全生命周期的操作日志及变更追踪Service业务层处理
 *
 * @author ruoyi
 * @date 2025-05-22
 */
@Service
public class VoucherOperationLogServiceImpl implements IVoucherOperationLogService
{
    @Autowired
    private VoucherOperationLogMapper voucherOperationLogMapper;

    /**
     * 查询代金券操作记录信息
     *
     * @param id 代金券操作记录，记录代金券全生命周期的操作日志及变更追踪主键
     * @return 代金券操作记录，记录代金券全生命周期的操作日志及变更追踪
     */
    @Override
    public VoucherOperationLog selectVoucherOperationLogById(Long id)
    {
        return voucherOperationLogMapper.selectVoucherOperationLogById(id);
    }

    /**
     * 通过条件查询代金券操作记录列表
     *
     * @param operationType,voucherCode,operationStartTime,operationEndTime 操作类型，代金券编码，操作开始时间，操作结束时间
     * @return 代金券操作记录，记录代金券全生命周期的操作日志及变更追踪
     */
    @Override
    public List<VoucherOperationLog> selectVoucherOperationLogListByConditions(String operationType, String voucherCode, Date operationStartTime, Date operationEndTime)
    {
        return voucherOperationLogMapper.selectVoucherOperationLogListByConditions(operationType,voucherCode,operationStartTime,operationEndTime);
    }

    /**
     * 新增代金券操作记录
     *
     * @param voucherOperationLog 代金券操作记录，记录代金券全生命周期的操作日志及变更追踪
     * @return 结果
     */
    @Override
    public int insertVoucherOperationLog(VoucherOperationLog voucherOperationLog)
    {
        voucherOperationLog.setCreateTime(DateUtils.getNowDate());
        return voucherOperationLogMapper.insertVoucherOperationLog(voucherOperationLog);
    }

    /**
     * 修改代金券操作记录
     *
     * @param voucherOperationLog 代金券操作记录，记录代金券全生命周期的操作日志及变更追踪
     * @return 结果
     */
    @Override
    public int updateVoucherOperationLog(VoucherOperationLog voucherOperationLog)
    {
        return voucherOperationLogMapper.updateVoucherOperationLog(voucherOperationLog);
    }

    /**
     * 通过id批量删除代金券操作记录信息
     *
     * @param ids 需要删除的代金券操作记录，记录代金券全生命周期的操作日志及变更追踪主键
     * @return 结果
     */
    @Override
    public int deleteVoucherOperationLogByIds(Long[] ids)
    {
        return voucherOperationLogMapper.deleteVoucherOperationLogByIds(ids);
    }

    /**
     * 通过id删除代金券操作记录信息
     *
     * @param id 代金券操作记录，记录代金券全生命周期的操作日志及变更追踪主键
     * @return 结果
     */
    @Override
    public int deleteVoucherOperationLogById(Long id)
    {
        return voucherOperationLogMapper.deleteVoucherOperationLogById(id);
    }
}
